import { Member } from "./../interface/index";
import { Login } from "../interface";
import { service } from "../service";
import authMenuList from "@/assets/json/authMenuList.json";
import personList from "@/assets/json/personList.json";

/*************************** 单位换算 START ******************************/
/**
 * @use 获取单位换算列表
 */
export const getUnitsApi = (params: any) => {
  return service.get<any>(`/v1/sdata/human/attribute/unit/cover/`, { params });
};

/**
 * @use 新增单位换算列表
 */
export const addUnitsApi = (params) => {
  return service.post<any>(`/v1/sdata/human/attribute/unit/cover/`, params);
};

/**
 * @use 编辑单位换算列表
 */
export const updateUnitsApi = (params, id) => {
  return service.put<any>(`/v1/sdata/human/attribute/unit/cover/${id}`, params);
};

/**
 * @use 删除单位换算列表
 */
export const deleteUnitsApi = (id) => {
  return service.delete<any>(`/v1/sdata/human/attribute/unit/cover/${id}`);
};

/*************************** 单位换算 END ******************************/

/**
 * @use 新增常量X医学常数名
 */
export const addMedicineApi = (params: any) => {
  return service.post<any>(`/v1/sdata/human/attribute/`, params);
};

/**
 * @use 获取X医学所有信息
 */
export const getMedicineListApi = (params: any) => {
  return service.get<any>(`/v1/sdata/human/attribute`, { params });
};

/**
 * @use 修改X医学某条数据
 */
export const updataMedicineApi = (params: any, id: string) => {
  console.log("row数据", params);
  console.log("id", id);
  return service.put<any>(`/v1/sdata/human/attribute/${id}`, params);
};

/**
 * @use 删除X医学某条数据
 */
export const deleteMedicineApi = (params: any) => {
  return service.delete<any>(`/v1/sdata/human/attribute/${params}`);
};

/**
 * @use 会员产品
 */
export const getMembershipListApi = (params: any) => {
  return service.get<any>(`/v1/sproduct/all/`, { params });
};

/**
 * @use 获取所属系统列表(如: "元素系统","免疫系统"...)
 */

export const getSystemListApi = () => {
  return service.get<any>("/v1/sdata/human/attribute/system/list");
};

/**
 * @use 获取会员管理信息
 */
export const getMembersApi = (_params: Member.ReqMember) => {
  // return service.get<Member.ResMember>(`/v1/suser/all/info`, { params });
  return personList;
};

/**
 * @use 获取验证码
 */
export const getCodeApi = () => {
  return service.get<Login.ResCode>(`/v1/suser/login`);
};

/**
 * @use 登录
 */
export const loginApi = (params: any) => {
  return service.post<any>(`/v1/suser/login`, params);
};

/**
 * @use 获取菜单列表
 */
export const getAuthMenuListApi = () => {
  // return ownHttp.get<Menu.MenuOptions[]>(`/user/sq/config/menu.info`);
  // 如果想让菜单变为本地数据，注释上一行代码，并引入本地 authMenuList.json 数据
  return authMenuList;
};
